/*
 * @Author: your name
 * @Date: 2021-07-10 22:15:00
 * @LastEditTime: 2021-07-12 15:53:58
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \TEST\Core\mycode\openmv.h
 */

#ifndef _OPENMV_H_
#define _OPENMV_H_

#include "usart.h"

 /**
  * @description: 用于保存一个目标信息的结构体
  * @param {*}
  * @return {*}
  */
 typedef struct
 {
     float x;
     float y;
     float d;
 }ONE_target_data;
/**
 * @description:用来保存一类目标的结构体
 * @param {*}
 * @return {*}
 */
typedef struct
{
    ONE_target_data target[3];
}ONE_class_data;
/**
 * @description: 用来保存openmv穿过来全部数据的结构体，包括三类目标，每类目标中包括三个目标
 * @param {*}
 * @return {*}
 */
typedef struct
{
    ONE_class_data class[3];
}OPENMV_data;

typedef struct
{
    int yuzhi[6];
}ONE_class_yuzhi;

typedef struct
{
    ONE_class_yuzhi class[3];
}OPENMV_yuzhi;
typedef struct
{
    uint8_t a_buffer[1];
    uint8_t data_buffer[20];
    uint8_t yuzhi_buffer[50];
    int counter;//计数收到了几个数据
    int finished_data;//结束收集数据的标志
    int finished_yuzhi;//结束收集阈值的标志
    int now_data;//1表示现在接收的是数据
    int now_yuzhi;//1表示现在接收的是阈值
}OPENMV_Rx;

typedef struct
{
    uint8_t data_buffer[8];
}OPENMV_Tx;
OPENMV_Rx openmv_rx;
OPENMV_Tx openmv_tx;
OPENMV_data openmv_data;
OPENMV_yuzhi openmv_yuzhi;
void openmv_data_process(void);
void send_yuzhi_to_openmv(int class,int target,int much );
void send_command_to_openmv(int command);

#endif /* MYCODE_OPENMV_H_ */



